import java.awt.Graphics;
import java.awt.Rectangle;


public abstract class SpaceObject {

	protected double xVel;
	protected double yVel;
	
	double x,y;
	protected Sprite sprite;
	
	private Rectangle one = new Rectangle();
	private Rectangle two = new Rectangle();
	
	public SpaceObject(String spr, int x, int y)
	{
		this.sprite=SpriteStore.get().getSprite(spr);
		this.x=x;
		this.y=y;
		
	}
	
	public void move(long del)
	{
		x+=(del*xVel)/1000;
		y+=(del*yVel)/1000;
	}
	
	public void setHorMove(double dx)
	{
		this.xVel=dx;
	}
	
	public void setVertMove(double dy)
	{
		this.yVel=dy;
	}
	
	public double getHorMove(){
		return xVel;
	}
	
	public double getVertMove(){
		return yVel;
	}	
	
	public void draw(Graphics g){
		sprite.draw(g,(int)x, (int)y);
	}
	
	public int getX(){
		return (int)x;
	}
	
	public int getY(){
		return (int)y;
	}
	
	public void doLogic(){
		
	}
	
	public boolean collidesWith(SpaceObject other){
		one.setBounds((int)x, (int)y, sprite.getWidth(), sprite.getHeight());
		two.setBounds((int) other.x,(int) other.y,other.sprite.getWidth(),other.sprite.getHeight());
	
		return one.intersects(two);
		
	}
	
	public abstract void collidedWith(SpaceObject other);
	
	
}















